package kino.object;

import com.sun.org.apache.xpath.internal.operations.String;

import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;

/**
 * Kino对象
 */
public class KinoObject {
    /**
     * 对象类型
     */
    private KinoObjectTypeEnum type;
    /**
     * 对象实际引用
     */
    private Object obj;

    public KinoObject(KinoObjectTypeEnum type) {
        this.type = type;
        // TODO ZSET 还没想好用什么结构
        switch (type) {
            case KINO_STRING:
                this.obj = new String();
                break;
            case KINO_HASH:
                this.obj = new HashMap<>();
                break;
            case KINO_LIST:
                this.obj = new LinkedList<>();
                break;
            case KINO_SET:
                this.obj = new HashSet<>();
                break;
        }
    }

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    public KinoObjectTypeEnum getType() {
        return type;
    }

    public void setType(KinoObjectTypeEnum type) {
        this.type = type;
    }
}
